Attributes

In this lesson, we discuss the different types of attributes present in an ER diagram.

Attributes#

As stated in the previous lesson, each entity is described by a set of attributes. For example, the EMPLOYEE entity has attributes Name, Address, and Salary, etc.

Each attribute has a name, is associated with an entity, and has a range of values it is allowed to take (an employee’s salary cannot be negative). However, information about the domain of an attribute is not presented in the ER diagram.

In the entity-relationship diagram shown below, each attribute is represented by an oval with a name inside.

svg viewer
An EMPLOYEE entity represented along with its attributes.

Types of attributes#

There are a few types of attributes you need to be familiar with.

Simple attributes#

Simple attributes are the atomic value, i.e., they cannot be further divided. They are also called single-value attributes. In the COMPANY database, an example of this would be: Name = ‘John’ and Age = 23.

Composite attributes#

Composite attributes can be divided into smaller subparts, which represent more basic attributes with independent meanings. Therefore, composite attributes consist of a hierarchy of attributes. Using our COMPANY database example, the Address attribute may consist of House_No, Street and Suburb. So this would be written as Address = 59 (House_No), Meek Street (Street), Kingsford (Suburb). The diagram below illustrates this concept:

svg viewer
We can see simple and composite attributes highlighted in the diagram.

Multivalued attributes#

Multivalued attributes have a set of values for each entity. An example of a multivalued attribute from the COMPANY database; one employee may not have any college degrees, another may have one, and a third person may have two or more degrees. Therefore, different people can have a different amount of values for the Degrees attribute. This is illustrated in the diagram below:

svg viewer
In ER diagrams multivalued attributes are represented with double outlines.

Derived attributes#

Derived attributes are attributes that contain values calculated from other attributes. An example from the COMPANY database is that Age can be derived from the attribute Bdate. In this situation, Bdate is called a stored attribute, which is physically saved to the database. The image below highlights this concept:

svg viewer
In ER diagrams derived attributes are represented with dotted outlines.

The next lesson will be about keys and how they act as a constraint for entities.

Entities, Entity Sets and Entity Types
Keys
Mark as Completed
Report an Issue